<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/templates/common/taglib.jsp"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
       <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>${title }</title>
    <link rel="stylesheet" href="${basePath}/static/bootstrap/css/bootstrap.css"/>
    <link href="${basePath}/static/css/basic.css" rel="stylesheet" type="text/css">
    <link href="${basePath}/static/css/login.css" rel="stylesheet" type="text/css">
    <link href="${basePath}/static/css/list.css" rel="stylesheet" type="text/css">
 <%--    <link rel="stylesheet" href="${basePath}/static/css/content_leftNav.css"/>
    <link rel="stylesheet" href="${basePath}/static/css/FrontControl.css"/> --%>
    <script  type="text/javascript" src="${basePath}/static/js/jquery.min.js"></script>
	<script  type="text/javascript" src="${basePath}/static/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="${basePath}/static/page/jqPaginator/jqPaginator.js"></script>
    
</head>
<body>
<!--头部-->
	<%@include file="/WEB-INF/templates/common/header.jsp"%>
	<!------导航条-->
	<%@include file="/WEB-INF/templates/common/navigation.jsp"%>

<!--内容部分-->
<div class="list_main lay_out" class="clearfix">
    <div class="list_DH">
        <%@include file="/WEB-INF/templates/common/workTotalNav.jsp"%>
    </div>
    <div class="list_NR">
        <div class="loc">
            <h3 style="margin:0">计算质控</h3>
        </div>
        <div class="list_con_table">
            <div class="search_table">
                <ul class="clearfix" style="margin-bottom:0;">
                	<li class="Label_1" >出院日期：&nbsp;</li>
                    <li class="Label_4" style="text-align:left;padding-left:3px;width:280px"><input class="input_box" style="width:120px;" type="text"  name='startTime' id='outHospitalStartDate' value='2017-10-21' onFocus="WdatePicker()" /></li>
                    <li class="Label_5">
                        <div class="right" style="text-align:right">
                            <a onclick="searchQua()">查询</a>
                         	<a href="${basePath}/exportExcel/exportCountToExcel">导出</a>
                        </div>
                    </li>
                  
                </ul>
            </div> 
             <table class="Search_tableList" cellpadding="0" cellspacing="0">
             
              <tr>
                    <td class="tdLabel_4" colspan="11" style="font-size:18px;font-weight:700">病房工作量动态日报表</td>
              </tr>
              <tr>
                    <td class="tdLabel_4" >科室</td>
                    <td class="tdLabel_4"> 实有床位数</td>
                    <td class="tdLabel_4" >原有病人数</td>
                    <td class="tdLabel_4"> 入院病人数</td>
                    <td class="tdLabel_4" >他科转入人数</td>
                    <td class="tdLabel_4"> 转往他科人数</td>
                  
                    <td class="tdLabel_4"> 出院病人数</td>
                   
                    <td class="tdLabel_4"> 实有病人数</td>
                 
                </tr>
                
                <tbody id="tbody">
                 <tr>
                    <td class="tdLabel_5">101011-呼吸内科病房</td>
                    <td class="tdLabel_5">50</td>
                    <td class="tdLabel_5">41</td>
                    <td class="tdLabel_5">1</td>
                    <td class="tdLabel_5">1</td>
                    <td class="tdLabel_5">0</td>
                   
                    <td class="tdLabel_5">1</td>
                   
                     <td class="tdLabel_5">42</td>
                 
                </tr>
                 <tr>
                     <td class="tdLabel_5">101021-消化一科病房</td>
                    <td class="tdLabel_5">55</td>
                    <td class="tdLabel_5">35</td>
                    <td class="tdLabel_5">0</td>
                    <td class="tdLabel_5">0</td>
                    <td class="tdLabel_5">0</td>
                   
                    <td class="tdLabel_5">1</td>
                   
                     <td class="tdLabel_5">34</td>
                </tr>
                <tr>
                    <td class="tdLabel_5">101022-外科病房</td>
                    <td class="tdLabel_5">60</td>
                    <td class="tdLabel_5">56</td>
                    <td class="tdLabel_5">1</td>
                    <td class="tdLabel_5">1</td>
                    <td class="tdLabel_5">0</td>
                   
                    <td class="tdLabel_5">1</td>
                   
                     <td class="tdLabel_5">57</td>
                </tr>
                <tr>
                   <td class="tdLabel_5">101031-感染性疾病病房</td>
                    <td class="tdLabel_5">50</td>
                    <td class="tdLabel_5">41</td>
                    <td class="tdLabel_5">1</td>
                    <td class="tdLabel_5">1</td>
                    <td class="tdLabel_5">0</td>
                   
                    <td class="tdLabel_5">1</td>
                   
                     <td class="tdLabel_5">42</td>
                </tr>
                
                 <tr>
                   <td class="tdLabel_5">101041-心内科病房</td>
                    <td class="tdLabel_5">75</td>
                    <td class="tdLabel_5">49</td>
                    <td class="tdLabel_5">1</td>
                    <td class="tdLabel_5">1</td>
                    <td class="tdLabel_5">0</td>
                   
                    <td class="tdLabel_5">2</td>
                   
                     <td class="tdLabel_5">49</td>
                </tr>
              
               
            </table>
        </div>
        <!-- 
        	  <div class="pageList">
	            <ul class="pagination clearfix" id="page_plus"></ul>
	            <div class="pagination">
	                <div>总共：<b id="totalPage">0</b> 条信息    当前页是第 <b id="currentPage">0/0</b>　页</div>
	            </div>
       		 </div>
         -->
    </div>
</div>
<!------页脚部分--------->
<%@include file="/WEB-INF/templates/common/footer.jsp"%>

<!--JS部分-->
<script type="text/javascript">

	$(function(){
		$("#tbody").hide();
	});
	
	
	function searchQua(){
		$("#tbody").show();
		//queryQua(0,20);
	}

	function queryQua(currentStartNum,pageSize){
		
		var name=$("#name").val();
		var idCard=$("#idCard").val();
		var outHospitalStartDate=$("#outHospitalStartDate").val();
		var outHospitalEndDate=$("#outHospitalEndDate").val();
		
		if((outHospitalStartDate==null || outHospitalStartDate=="") && (outHospitalEndDate==null || outHospitalEndDate=='') && (name==null || name=='') && (idCard==null || idCard=='')){
			alert("请输入查询条件!");
			return;
		}
		

		
		
		jQuery.support.cors = true;
		$.ajax({
			type:"get",
			url:"http://localhost:8888/medical-manage/statis/queryMedrecordByAjax",
			data:{idCard:idCard,outHospitalStartDate:outHospitalStartDate,outHospitalEndDate:outHospitalEndDate,name:name,currentStartNum:currentStartNum,pageSize:pageSize},
			success:function(data){
				$("#tbody").html("");
				
				if(data.success){
					var hospitalizationNotes=data.data.hospitalizationNotes;
					var medRecordQuery=data.data.medRecordQuery;
					alert(medRecordQuery);
					var totalCounts=medRecordQuery.totalCounts;
					var html="";
					for(var i=0;i<hospitalizationNotes.length;i++){
						var hospitalizationNote=hospitalizationNotes[i];
						html+=" <tr>"+
				              "      <td class='tdLabel_5'>"+hospitalizationNote.mr_id+"</td>"+
				              "      <td class='tdLabel_5'>"+hospitalizationNote.name+"</td>"+
				              "      <td class='tdLabel_5'>"+hospitalizationNote.id_number+"</td>"+
				              "      <td class='tdLabel_5'>"+hospitalizationNote.out_hospital_date+"</td>"+
				              "      <td class='tdLabel_5' style='width:280px'><a class='btn' style='padding:6px 2px' target='_blank' href='${basePath}/statics/showMedrecordImage?firstGuid="+hospitalizationNote.first_level_medical_guid+"'>首页预览</a> <a class='btn' target='_blank' href='http://localhost:8888/medical-manage/medrecord/medrecordHomePageManage?firstGuid="+hospitalizationNote.first_level_medical_guid+"'>首页编辑</a></td>"+
				              "  </tr>";
					}
					
					$("#tbody").html(html);
					page(currentStartNum+1,totalCounts);
					
				}
	
			}
		})
		
	}
	
	 function page(currentPage,totalCounts){
		 alert(currentPage+"--"+totalCounts);
	    	//var totalCounts = 1000;
	        var pageSize = 20;
	        var visiblePages = 10;
	        //var currentPage = 1;
	        /* var totalPages = totalCounts%pageSize==0?(totalCounts/pageSize):(totalCounts/pageSize+1); */
	        var totalPages = Math.ceil(totalCounts/pageSize);
	        $('#page_plus').jqPaginator({

	            totalCounts: totalCounts,
	            pageSize:pageSize,
	            visiblePages: visiblePages,
	            currentPage: currentPage,

	            first:'<li class="first"><a href="javascript:void(0);">首页</a></li>',
	            prev: '<li class="prev"><a href="javascript:void(0);">上一页</a></li>',
	            next: '<li class="next"><a href="javascript:void(0);">下一页</a></li>',
	            last: '<li class="last"><a href="javascript:void(0);">末页</a></li>',
	            page: '<li class="page"><a href="javascript:void(0);">{{page}}</a></li>',
	            onPageChange: function (num,type) {
	          
	            	 if(type !='init'){
	                 
	            		 queryQua(num-1,pageSize);
	                 }
	            	
	                $("#totalPage").html(totalCounts);
	                $("#currentPage").html(num+"/"+totalPages);
	            }
	        });

	    }
	 
	
</script>

</body>
</html>